Skip to content

emrg: Add e2e tests for daemon evolution_summary (empty/ordered/limit-clamp/corrupt-skip) - #509

Merged
argszero merged 1 commit into
masterfrom
feature/evolution-summary-tests
Aug 6, 2026
Merged

emrg: Add e2e tests for daemon evolution_summary (empty/ordered/limit-clamp/corrupt-skip)#509
argszero merged 1 commit into
masterfrom
feature/evolution-summary-tests

Conversation

@argszero

@argszero argszero commented Aug 6, 2026

Copy link
Copy Markdown
Owner

Summary

The evolution_summary daemon command (added in #502, rant 21:35 — powers the GUI "recent improvements" list) had zero automated test coverage. Its review claimed "capped at 20, OSError-safe, empty-graceful" but nothing verified those guarantees. This PR adds two end-to-end protocol tests using the existing test_ws_e2e harness (real WebSocket server, isolated tmp config dir).

Tests added (tests/test_ws_e2e.py, TestWSEvolutionSummary)

  1. test_evolution_summary_empty_and_with_logs

    • Empty: no evolution log files → recent=[], count=0 (graceful empty).
    • With logs: 3 files written (logs/evolution-*.json), one corrupt JSON → corrupt file is skipped without crashing; result ordered newest-first (reverse-lexicographic = chronological); operations/impact fields round-trip.
  2. test_evolution_summary_limit_clamped_to_20

    • 25 log files + limit: 100 → response returns at most 20 entries, newest first (clamp upper bound).

Verification

  • New tests: 2 passed (run with -k EvolutionSummary).
  • Full suite: 482 passed (480 + 2). import + emrg --help OK.
  • Test-only change (no production code touched); CI test workflow validates on push.

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle 20260806-231433 (emrg-00c41753, author self-check, 1/3)

Verified the new tests exercise all four claims made in the #502 review: (1) empty logs → graceful empty reply; (2) recent list newest-first with operations/impact round-trip; (3) limit clamped to 20 (25 files + limit=100 → exactly 20); (4) corrupt evolution-*.json skipped without crashing the connection. Harness reuses the existing isolated-tmp _boot_server pattern (real ws, mocked LLM, no real scheduler). Full suite 482 pass; test-only change.

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle 20260806-232009 (emrg-00c41753, 2/3)

Strong addition — evolution_summary (from #502) had zero automated coverage despite my review claiming 'capped at 20, OSError-safe, empty-graceful'. Verified against the harness:

  • _boot_server monkeypatches config_dir → tmp, so tmp/logs is the real source — tests are hermetic (no host ~/.emrg coupling, per the #489 lesson)
  • Empty → count=0/recent=[]; corrupt file skipped without crash; newest-first ordering via reverse-lexicographic ISO filenames; limit clamped to 20 (25 written → 20 returned)
  • count==0 asserted correctly (in-memory evolutions empty in harness — matches daemon semantics: count = len(self.evolutions), recent = log files)
  • +83 lines in tests/test_ws_e2e.py only

CI pending — will confirm before merge.

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle 20260806-232437 (emrg-00c41753, 3/3)

Re-verified tests against the daemon implementation (daemon.py:874-907): logs_dir = config_dir()/logs matches the tmp-config harness; reverse-lexicographic sort + slice [:max(1,min(limit,20))] matches the 25-files→20 clamp assertion; JSONDecodeError/OSError skip matches the corrupt-file case; count=len(self.evolutions) matches the in-memory-empty assertion. Hermetic (no host ~/.emrg coupling). CI green, MERGEABLE.

@argszero
argszero merged commit 12f2cf5 into master Aug 6, 2026
1 check passed
@argszero
argszero deleted the feature/evolution-summary-tests branch August 6, 2026 15:26
argszero added a commit that referenced this pull request Aug 6, 2026
…426/#430/#510) (#511)

* emrg: docs — sync Python test count 480→482 (post-#509 merge drift)

* emrg: add test-count guard test — prevent recurring README/Agent.md drift

---------

Co-authored-by: EMRG Evolution <emrg@argszero.dev>
argszero added a commit that referenced this pull request Aug 6, 2026
…18n leak closures, e2e tests, doc-count guard) (#512)

Co-authored-by: EMRG Evolution <emrg@argszero.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant